package com.ruoyi.stateMachineDemo.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.stateMachineDemo.bean.GoodOrder;
import com.ruoyi.stateMachineDemo.service.GoodOrderService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/goodOrder")
@ApiModel("状态机测试订单状态")
public class GoodOrderController extends BaseController {

    @Autowired
    private GoodOrderService goodOrderService;

    @PostMapping("/createOrder")
    @ApiOperation("创建订单")
    public AjaxResult createOrder(@RequestBody GoodOrder goodOrder){
        goodOrderService.createOrder(goodOrder);
        return AjaxResult.success();
    }

    @PutMapping("/payOrder")
    @ApiOperation("支付订单")
    public AjaxResult payOrder(@RequestBody GoodOrder goodOrder){
        goodOrderService.payOrder(goodOrder);
        return AjaxResult.success();
    }
    @ApiOperation("收货")
    @PostMapping("/receive")
    public AjaxResult receive(@RequestBody GoodOrder goodOrder){
        goodOrderService.receive(goodOrder);
        return AjaxResult.success();
    }



}
